package action.menu;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import service.MenuService;
import vo.MenuVO;

public class SearchAllMenuAction implements SessionAware{
	
	private MenuService menuService;
	private String member_id;
	private ArrayList<MenuVO> list;
	private Map<String, Object> session;
	
	public MenuService getMenuService() {
		return menuService;
	}
	public void setMenuService(MenuService menuService) {
		this.menuService = menuService;
	}
	public String getMember_id() {
		return member_id;
	}
	public void setMember_id(String memberId) {
		member_id = memberId;
	}
	public ArrayList<MenuVO> getList() {
		return list;
	}
	@Override
	public void setSession(Map<String, Object> session) {
		// TODO Auto-generated method stub
		this.session = session;
	}
	public String execute(){
		String member = (String)session.get("member_id");
		if(member != null){
			setMember_id(member);
		}
		try {
			list = menuService.getAllMenu(member_id);
			System.out.println(list);
		} catch (SQLException e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return "success";
	}
}
